home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / tclX6.4c / dist / tests / arrayproc.test < prev    next >
Encoding:
Text File  |  1992-11-07  |  1.3 KB  |  42 lines

  1. #
  2. # arrayproc.test
  3. #
  4. # Tests for tcl.tlib array routines.
  5. #---------------------------------------------------------------------------
  6. # Copyright 1992 Karl Lehenbauer and Mark Diekhans.
  7. #
  8. # Permission to use, copy, modify, and distribute this software and its
  9. # documentation for any purpose and without fee is hereby granted, provided
  10. # that the above copyright notice appear in all copies.  Karl Lehenbauer and
  11. # Mark Diekhans make no representations about the suitability of this
  12. # software for any purpose.  It is provided "as is" without express or
  13. # implied warranty.
  14. #------------------------------------------------------------------------------
  15. # $Id: arrayproc.test,v 2.0 1992/10/16 04:49:27 markd Rel $
  16. #------------------------------------------------------------------------------
  17. #
  18.  
  19. if {[info procs test] == ""} then {source testlib.tcl}
  20. rename SAVED_UNKNOWN unknown
  21.  
  22. set testArray(foo) bar
  23. set testArray(snap) frammistan
  24. set testArray(0) zero
  25. set testArray(william) dafoe
  26.  
  27. Test for_array_keys-1.1 {for_array_keys command} {
  28.     for_array_keys key testArray {lappend result $key}
  29.     lsort $result
  30. } 0 "0 foo snap william"
  31.  
  32. unset result
  33.  
  34. Test for_array_keys-1.2 {errors in for_array_keys command} {
  35.     for_array_keys key _non_existent_ {lappend result $key}
  36. } 1 {"_non_existent_" isn't an array}
  37.  
  38. unset testArray
  39. rename unknown SAVED_UNKNOWN
  40.  
  41.  
  42.